Skip to content

feat: OGG/Opus import and OGG export (#330) - #331

Merged
thcp merged 1 commit into
mainfrom
feat/ogg-opus-upload
Aug 5, 2026
Merged

feat: OGG/Opus import and OGG export (#330)#331
thcp merged 1 commit into
mainfrom
feat/ogg-opus-upload

Conversation

@thcp

@thcp thcp commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

What

Adds OGG/Opus import and OGG export, closing #330.

Import (.ogg + .opus)

The pipeline was already format-agnostic — every local upload is transcoded to 16-bit/44.1 kHz stereo WAV by ffmpeg (_prepare_local_source) before Demucs runs — so the only barriers were extension allow-lists:

  • app/api/jobs.py_ALLOWED_EXTS + the 422 detail string
  • static/index.html — file-picker accept= list
  • static/js/main.js — drop/picker validation + error message
  • static/mobile/app.js — adds .opus; fixes a latent bug: the mobile accept list already advertised .ogg but the server rejected it with a raw 422

.ogg covers both Vorbis and Opus-in-Ogg; .opus is the Opus convention. ffmpeg decodes both — no codec branching.

Export (OGG)

Following the FLAC precedent (#194): OGG (Vorbis VBR q6, ~192 kbps — the quality tier matching the existing MP3 setting) added to

  • app/api/stems.py_ENCODE_ARGS/MIXDOWN_CODECS/media types, mixdown + region + all.zip validation
  • static/index.html + static/js/main.js — OGG button in the export format toggle (download helpers were already format-generic)

Tests

  • Repointed the three negative tests that used ogg as the "unsupported" fixture (now .aiff)
  • New: test_upload_ogg_returns_job_id, test_upload_opus_returns_job_id, and an ffmpeg-gated test_all_stems_zip_ogg asserting real OggS output

Verification

  • ✅ Full suite: 232 passed (with ffmpeg on PATH so transcode tests run)
  • ruff check + ruff format --check both clean
  • ✅ E2E decode: generated real Vorbis and Opus files and ran them through the exact _prepare_local_source ffmpeg command shape — both transcode to the expected 44.1 kHz stereo s16 WAV

Import: accept .ogg (Vorbis or Opus in Ogg) and .opus uploads. The
pipeline already transcodes every local upload to 16-bit/44.1 kHz WAV
via ffmpeg before Demucs, so only the extension allow-lists change:
the API gate, the web file picker/drop validation, and the mobile
accept list (which already advertised .ogg but got a server 422).

Export: add OGG (Vorbis VBR q6, ~192 kbps — the quality tier matching
the MP3 setting) to the mixdown, region, and stems-zip endpoints plus
the export format toggle in the player.

Tests: the unsupported-extension fixtures used .ogg and now use .aiff;
new upload tests for .ogg/.opus and an ffmpeg-gated OGG zip transcode
test asserting real OggS output.

Closes #330
@thcp
thcp merged commit c0e4f72 into main Aug 5, 2026
8 checks passed
@thcp
thcp deleted the feat/ogg-opus-upload branch August 5, 2026 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant